<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<title>IP地址库</title>
<head th:replace="common/incHead :: incHead"></head>
<body class="gray-bg">
<div class="ok-body">
    <form class="layui-form layui-form-pane" lay-filter="pagerForm" id="pagerForm" action="/base/const/ip" method="get">
        <input type="hidden" id="pageNum" name="pageNum" value="1"/>
        <input type="hidden" id="numPerPage" name="numPerPage" th:value="${page.numPerPage}"/>
        <input type="hidden" id="orderField" name="orderField" th:value="${orderField}"/>
        <input type="hidden" id="orderDirection" name="orderDirection" th:value="${orderDirection}"/>
        <div class="layui-row pa-condition">
            <div class="layui-row">
                <div th:replace="common/plugin :: pa-input-cond('ts','开始时间','layui-col-md2',${ts})"></div>
                <div th:replace="common/plugin :: pa-input-cond('te','结束时间','layui-col-md2',${te})"></div>
                <div th:replace="common/plugin :: pa-input-cond('ipVal','IP地址','layui-col-md2',${ipVal})"></div>
                <div th:replace="common/plugin :: pa-input-cond('provinceName','省份名称','layui-col-md2',${provinceName})"></div>
                <div th:replace="common/plugin :: pa-input-cond('cityName','城市名称','layui-col-md2',${cityName})"></div>
            </div>
            <div class="layui-row">
                <div th:replace="common/plugin :: pa-input-cond('pointX','所属国家','layui-col-md2',${pointX})"></div>
                <div th:replace="common/plugin :: pa-input-cond('pointY','运营商户','layui-col-md2',${pointY})"></div>
                <div th:replace="common/plugin :: pa-input-cond('dataSrc','数据来源','layui-col-md2',${dataSrc})"></div>
                <button class="layui-btn layui-btn-sm layui-btn-primary pull-right m-l-xs" title="重置数据" type="reset"><i class="layui-icon layui-icon-return"></i>重置</button>
                <button class="layui-btn layui-btn-sm layui-btn-normal pull-right btnPagerForm" title="重新检索"><i class="layui-icon layui-icon-search"></i>重新检索</button>
            </div>
        </div>
    </form>
    <div class="layui-row ljLayTableBox m-b-xl">
        <table class="layui-hide" id="indexTable" lay-filter="indexTable"></table>
    </div>
</div>
<div th:replace="common/incBottom :: incBottom"></div>
<div th:replace="common/incPage :: incPage"></div>
<!-- 初始化表格数据 -->
<script th:inline="javascript">
    /*<![CDATA[*/
    let initSort = {
        field: [[${orderField}]] || 'id',
        type: [[${orderDirection}]] || 'desc'
    };
    let indexData = [];
    /*[# th:each="item,itemStat:${records}"]*/
    indexData.push({
        id: [[${item.id}]],
        ipVal: [[${item.ipVal}]],
        provinceId: [[${item.provinceId}]],
        provinceName: [[${item.provinceName}]],
        cityId: [[${item.cityId}]],
        cityName: [[${item.cityName}]],
        pointX: [[${item.pointX}]],
        pointY: [[${item.pointY}]],
        dataSrc: [[${item.dataSrc}]],
        dataStatus: [[${item.dataStatus}]],
        createTime: [[${@lj.date(item.createTime)}]]
    });
    /*[/]*/
    /*]]>*/
</script>
<script th:inline="none">
    layui.use(["jquery", "table", "okLayer", "okPapper", "okUtils"], function () {
        let table = layui.table;
        let okPapper = layui.okPapper;
        let $ = layui.jquery;
        let okUtils = layui.okUtils;
        let config = okUtils.local("okConfig") || okConfig || {};
        table.render({
            elem: '#indexTable',
            id: 'indexTable',
            height: 'full-158',
            page: false,
            data: indexData,
            limit: indexData.length,
            initSort: initSort,
            toolbar: true,
            toolbar: "#toolbarTpl",
            size: config.tableSize,
            cols: [[
                {type: "checkbox", fixed: "left"},
                {field: "id", title: "自增ID", fixed: "left", width: 90, sort: true},
                {field: "ipVal", title: "IP地址", fixed: "left", width: 150},
                {field: "provinceId", title: "省份编码", width: 100},
                {field: "provinceName", title: "省份名称", width: 100,},
                {field: "cityId", title: "城市编码", width: 100,},
                {field: "cityName", title: "城市名称", width: 100,},
                {field: "pointX", title: "经纬度X", minWidth: 160,},
                {field: "pointY", title: "经纬度Y", minWidth: 160,},
                {field: "dataSrc", title: "数据来源", align: 'center', width: 100,},
                {field: "dataStatus", title: "数据状态", width: 90, align: 'center', templet: "#DataStatusTpl"},
                {field: "createTime", title: "创建时间", width: 150,},
                {title: "操作", width: 220, align: "center", fixed: "right", templet: "#operationTpl"}
            ]],
            done: function (res, curr, count) {
            }
        });
        table.on('sort(indexTable)', function (obj) {
            $("input[name='orderField']").val(obj.field);
            $("input[name='orderDirection']").val(obj.type);
            $("#pagerForm").submit();
        });
        okPapper.init();
        okLoading.close($);
    })
</script>
<div th:replace="common/plugin :: pa-input-datatime('ts,te')"></div>
<!-- 头工具栏模板 -->
<script type="text/html" id="toolbarTpl">
    <div class="layui-btn-container">
        <button th:if="${@lj.limit('BaseConstIpAdd')>0}" class="layui-btn layui-btn-sm layui-btn-normal" title="IP地址库新增" refTable="indexTable" ljUrl="/base/const/ip/add" target="ljOpenSubmit" ljWidth="400px"
                ljHeight="300px">
            <i class="layui-icon layui-icon-add-circle"></i>添加
        </button>
        <button th:if="${@lj.limit('BaseConstIpRedo')>0}" class="layui-btn layui-btn-sm layui-btn-warm" title="确认要重取该记录吗?" refTable="indexTable" ljUrl="/base/const/ip/redo?id={tid}" target="ljAjaxTodo">
            <i class="layui-icon layui-icon-upload-circle"></i>重取
        </button>
    </div>
</script>
<!-- 默认统一操作模板 -->
<div th:replace="common/operation :: pa_operation_default('BaseConstIp','IP地址库','/base/const/ip','{{d.id}}')"></div>
<!-- DataStatus枚举模板 -->
<div th:replace="common/enum :: pa_enum_DataStatus"></div>
</body>
</html>